package com.bnz.manager.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bnz.manager.entity.SellerEntity;
import com.bnz.manager.service.SellerService;
import com.bnz.common.utils.PageUtils;
import com.bnz.pojo.R;



/**
 * 
 *
 * @author baizhi
 * @email 315104869@qq.com
 * @date 2022-10-30 15:21:50
 */
@RestController
@RequestMapping("manager/seller")
public class SellerController {
    @Autowired
    private SellerService sellerService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("manager:seller:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = sellerService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{sellerId}")
        public R info(@PathVariable("sellerId") String sellerId){
		SellerEntity seller = sellerService.getById(sellerId);

        return R.ok().put("seller", seller);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
        public R save(@RequestBody SellerEntity seller){
		sellerService.save(seller);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
        public R update(@RequestBody SellerEntity seller){
		sellerService.updateById(seller);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
        public R delete(@RequestBody String[] sellerIds){
		sellerService.removeByIds(Arrays.asList(sellerIds));

        return R.ok();
    }

}
